using HCore.Tests.Runtime.ShootingEditor2D.Scripts.Command;
using HCore.Tests.Runtime.ShootingEditor2D.Scripts.Support;
using UnityEngine;

namespace HCore.Tests.Runtime.ShootingEditor2D.Scripts.ViewController.GamePlay
{
    /// <summary>
    ///     补给站类，用于处理玩家进入触发区域时的子弹补给逻辑
    /// </summary>
    public class SupplyStation : HCoreCommandMonoBehaviour
    {
        /// <summary>
        ///     当2D碰撞体进入触发器时调用此方法
        /// </summary>
        /// <param name="other">进入触发器的碰撞体对象</param>
        private void OnTriggerEnter2D(Collider2D other)
        {
            // 检查进入触发器的对象是否为玩家，如果是则发送全子弹命令
            if (other.CompareTag("Player")) SendCommand(new FullBulletCommand());
        }
    }
}